package com.industrial.operation.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.industrial.common.log.annotation.Log;
import com.industrial.common.log.enums.BusinessType;
import com.industrial.common.security.annotation.RequiresPermissions;
import com.industrial.operation.domain.gxhzb.OperationIndexManager;
import com.industrial.operation.service.IOperationIndexManagerService;
import com.industrial.common.core.web.controller.BaseController;
import com.industrial.common.core.web.domain.AjaxResult;
import com.industrial.common.core.utils.poi.ExcelUtil;
import com.industrial.common.core.web.page.TableDataInfo;

/**
 * 工业运行评价-个性化指标管理Controller
 *
 * @author SangGuangCan
 * @date 2024-02-20
 */
@RestController
@RequestMapping("/operation/kfqkh/index")
public class OperationIndexManagerController extends BaseController
{
    @Autowired
    private IOperationIndexManagerService operationIndexManagerService;

    /**
     * 查询工业运行评价-个性化指标管理列表
     */
    @RequiresPermissions("operation:operation:list")
    @GetMapping("/list")
    public TableDataInfo list(OperationIndexManager operationIndexManager)
    {
        startPage();
        List<OperationIndexManager> list = operationIndexManagerService.selectOperationIndexManagerList(operationIndexManager);
        return getDataTable(list);
    }

    /**
     * 导出工业运行评价-个性化指标管理列表
     */
    @RequiresPermissions("operation:operation:export")
    @Log(title = "工业运行评价-个性化指标管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, OperationIndexManager operationIndexManager)
    {
        List<OperationIndexManager> list = operationIndexManagerService.selectOperationIndexManagerList(operationIndexManager);
        ExcelUtil<OperationIndexManager> util = new ExcelUtil<OperationIndexManager>(OperationIndexManager.class);
        util.exportExcel(response, list, "工业运行评价-个性化指标管理数据");
    }

    /**
     * 获取工业运行评价-个性化指标管理详细信息
     */
    @RequiresPermissions("operation:operation:query")
    @GetMapping(value = "/{baseId}")
    public AjaxResult getInfo(@PathVariable("baseId") String baseId)
    {
        return success(operationIndexManagerService.selectOperationIndexManagerByBaseId(baseId));
    }

    /**
     * 新增工业运行评价-个性化指标管理
     */
    @RequiresPermissions("operation:operation:add")
    @Log(title = "工业运行评价-个性化指标管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OperationIndexManager operationIndexManager)
    {
        return toAjax(operationIndexManagerService.insertOperationIndexManager(operationIndexManager));
    }

    /**
     * 修改工业运行评价-个性化指标管理
     */
    @RequiresPermissions("operation:operation:edit")
    @Log(title = "工业运行评价-个性化指标管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OperationIndexManager operationIndexManager)
    {
        return toAjax(operationIndexManagerService.updateOperationIndexManager(operationIndexManager));
    }

    /**
     * 删除工业运行评价-个性化指标管理
     */
    @RequiresPermissions("operation:operation:remove")
    @Log(title = "工业运行评价-个性化指标管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{baseIds}")
    public AjaxResult remove(@PathVariable String[] baseIds)
    {
        return toAjax(operationIndexManagerService.deleteOperationIndexManagerByBaseIds(baseIds));
    }

    @GetMapping("/queryIndexInfo")
    public AjaxResult queryIndexInfo(OperationIndexManager operationIndexManager){
        return operationIndexManagerService.queryIndexInfo(operationIndexManager);
    }
}
